﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


namespace CA.RetailBeerSystems.POSServiceObjects.Scanners
{
    public class HandHeldDeviceInfo
    {
        // Fields
        private const int HANDHELD_VID = 0x218;
        private static DictionaryEntry IT_3800_14 = new DictionaryEntry(0x127, "IT3800-14");
        private static DictionaryEntry IT_3800_15 = new DictionaryEntry(0x107, "IT3800-15");
        private static DictionaryEntry IT_3800_G = new DictionaryEntry(0x2e7, "3800G");
        private static DictionaryEntry IT_4010 = new DictionaryEntry(0x1e7, "IT4010");
        private static DictionaryEntry IT_4080 = new DictionaryEntry(0x227, "IT4800");
        private static DictionaryEntry IT_4200 = new DictionaryEntry(0x287, "IT4200");
        private static DictionaryEntry IT_4600 = new DictionaryEntry(0x207, "IT4600");
        private static DictionaryEntry IT_4800 = new DictionaryEntry(0x1c7, "IT4800");
        private static DictionaryEntry IT_5600 = new DictionaryEntry(0x167, "IT5600");
        private static DictionaryEntry IT_5620 = new DictionaryEntry(0x267, "IT5620");
        private static DictionaryEntry IT_5800 = new DictionaryEntry(0x187, "IT5800");
        private ArrayList scannerAryLst = new ArrayList();


        // Methods
        public HandHeldDeviceInfo()
        {
            this.initScannerAryLst();

        }  // END: public HandHeldDeviceInfo()

        private bool Contains(int pid)
        {
            return this.scannerAryLst.Contains(pid);

        }  // END: private bool Contains(int pid)

        ~HandHeldDeviceInfo()
        {
            this.scannerAryLst.Clear();

        }  // END: ~HandHeldDeviceInfo()

        public string getModelName(int pid)
        {
            string str = "UNKNOWN";
            if (this.isValidPID(pid))
            {
                str = (string) this.scannerAryLst[pid];
            }
            return str;

        }  // END: public string getModelName(int pid)

        private void initScannerAryLst()
        {
            this.scannerAryLst.Add(IT_3800_15);
            this.scannerAryLst.Add(IT_3800_14);
            this.scannerAryLst.Add(IT_3800_G);
            this.scannerAryLst.Add(IT_5600);
            this.scannerAryLst.Add(IT_5800);
            this.scannerAryLst.Add(IT_4800);
            this.scannerAryLst.Add(IT_4010);
            this.scannerAryLst.Add(IT_4200);
            this.scannerAryLst.Add(IT_4600);
            this.scannerAryLst.Add(IT_5620);
            this.scannerAryLst.Add(IT_4080);

        }  // END: private void initScannerAryLst()

        public static bool isHandHeldScanner(int vid)
        {
            bool flag = false;
            if (vid == 0x218)
            {
                flag = true;
            }
            return flag;

        }  // END: public bool isHandHeldScanner(int vid)

        public bool isMatrixScanner(int pid)
        {
            bool flag = true;
            if (!this.isValidPID(pid))
            {
                return flag;
            }
            switch (pid)
            {
                case 0x107:
                case 0x127:
                    return false;
            }
            return true;

        }  // END: public bool isMatrixScanner(int pid)

        public bool isValidPID(int pid)
        {
            return this.Contains(pid);

        }  // END: public bool isValidPID(int pid)


    }  // END: public class HandHeldDeviceInfo

}  // END: CA.RetailBeerSystems.POSServiceObjects.Scanners
